package com.leaves.sys.events;

import cn.hutool.extra.spring.SpringUtil;
import com.leaves.core.consts.SymbolConstant;
import com.leaves.sys.modular.file.service.SysFileInfoService;

/**
 * @Author Chenweiwei
 * @Date 2021/12/9 11:26
 * @Version 1.0
 */
public class CommonEvent {

    /**
     * 文件标识,对于表单上传附件的文件提交时进行标识，未标识文件将在定时任务中清理。
     *
     * @param id             文件id
     * @param identification 标识位
     */
    public static void dentificationFile(Long id, String identification) {
        SysFileInfoService fileInfoService = SpringUtil.getBean(SysFileInfoService.class);
        fileInfoService.identificationFile(id, identification);
    }

    public static void dentificationFileEmpty(Long oldFileId) {
        SysFileInfoService fileInfoService = SpringUtil.getBean(SysFileInfoService.class);
        fileInfoService.identificationFile(oldFileId, SymbolConstant.SPACE);
    }
}
